package com.lysj.order.order.controller;

import com.lysj.admin.utils.spring.foundation.base.BaseController;
import com.lysj.admin.utils.spring.foundation.pagination.PageVo;
import com.lysj.admin.utils.web.Resp;
import com.lysj.order.order.domain.Order;
import com.lysj.order.order.dto.OrderQueryDto;
import com.lysj.order.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * @author Created by drj on 2019-03-07 16:36:33
 * @description 订单控制层
 */
@Slf4j
@RestController
@RequestMapping("/order/order")
public class OrderController extends BaseController<Order> {

    @Resource
    private OrderService orderService;

    @Override
    public OrderService getService() {
        return orderService;
    }


    /*
     * @author drj
     * @date 2019-03-28 17:09
     * @Description :订单后台获取订单列表
     */
    @GetMapping("/list_rewrite")
    public Resp orderList(OrderQueryDto orderQueryDto, PageVo pageVo) {
        return new Resp().success(orderService.orderList(orderQueryDto, pageVo));
    }

    /*
     * @author drj
     * @date 2019-03-28 16:37
     * @Description :工作台点击餐桌显示订单详情
     */
    @GetMapping("/work_bench_detail")
    public Resp detail(String deskId) {
        return new Resp().success(orderService.workBenchOrderDetail(deskId));
    }

    /*
     * @author drj
     * @date 2019-04-11 14:29
     * @Description :退款操作
     */
    @PostMapping("/refund")
    public Resp refund(String orderId, Integer status) {
        return new Resp().success(orderService.refund(orderId, status));
    }
}
